//2009/08/18 21:14:18
#include <iostream>
#include <string>
#include <vector>
#include <map>
#include <queue>
#include <sstream>
#include <algorithm>

using namespace std;

class SandwichBar
{
public:
    int whichOrder(vector <string> available, vector <string> orders)
    {
        for (int i=0; i<orders.size(); i++)
        {
            bool flag = true;
            stringstream s(orders[i]);
            string str;
            while (s >> str)
            {
                if (!check(str, available))
                {
					flag = false;
					break;
                }
            }
			if(flag) return i;
        }
		return -1;
    }
private:
    bool check(string s, vector<string> available)
    {
        for (int i=0; i<available.size(); i++)
            if (available[i] == s)
                return true;
        return false;
    }
};
